<?php

namespace App\Controller\Web;

use App\Base\BaseController4Web;
use App\Model\ArtCategoryModel;
use App\Project\ZhengHuaModel;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;

class ListController extends BaseController4Web
{
    /**
     * @route("/ArtListPic",name="ArtListPic")
     */
    public function ArtListPic(Request $request)
    {
        $this->initData();
        if (!$page = $request->query->get("page")) { $page = 0; }
        if (!$limit = $request->query->get("limit")) { $limit = 10; }
        if (!$category = $request->query->get("category")) { $category = 0; }
        if (!$tpl = $request->query->get("tpl")) { $tpl = "index" ; }
        if (!$province = $request->query->get("province")) {$province=0;}
        $ZhengHuaModel = new ZhengHuaModel($this->getDoctrine());
//        var_dump($province);
        $data = $ZhengHuaModel->getIndexData($category,$page,$limit,$province);
        $this->data["list"] = $data;

        return $this->render("Web/List/$tpl.html.twig", $this->data);
    }



    /**
     * @route("/ArtCatList",name="ArtCatList")
     */
    public function ArtCatList(Request $request)
    {
        $this->initData();
        if (!$category = $request->query->get("category")) { $category = 0; }
        if (!$tpl = $request->query->get("tpl")) { $tpl = "cat_head_1" ; }
        $ArtCategoryModel = new ArtCategoryModel($this->getDoctrine());
        $data = $ArtCategoryModel->getSons($category);
        $this->data["list"] = $data;

        return $this->render("Web/List/$tpl.html.twig", $this->data);
    }



}
